package oa.hleast.common.utils;

import oa.hleast.common.base.BaseCodeEnum;
import oa.hleast.common.base.BaseCodeEnum;

/**
 * @author 00209
 * @desc 枚举类工具类
 * @email dz@hleast.com
 * @Date 2021/03/01 22:01:45
 */
public class EnumUtils {

    public static <T extends BaseCodeEnum> T getByCode(Integer code, Class<T> enumClass) {
        for (T each: enumClass.getEnumConstants()) {
            if (code.equals(each.getCode())) {
                return each;
            }
        }
        return null;
    }
}
